package rw.ac.kiosc.jdbc.school.orm;

import java.io.Serializable;
import org.w3c.dom.*;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author antoine
 */
public class Student implements Serializable {

    private int studentId;
    private String registrationNumber;
    private String name;
    private int yearOfStudy;
    private Department department;

    public Student() {
    }

    public Student(String registrationNumber, String name, int yearOfStudy, Department department) {
        this.registrationNumber = registrationNumber;
        this.name = name;
        this.yearOfStudy = yearOfStudy;
        this.department = department;
    }

    public Student(int studentId, String registrationNumber, String name, int yearOfStudy, Department department) {
        this.studentId = studentId;
        this.registrationNumber = registrationNumber;
        this.name = name;
        this.yearOfStudy = yearOfStudy;
        this.department = department;
    }

    public Department getDepartment() {
        return department;
    }

    public void setDepartment(Department department) {
        this.department = department;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getRegistrationNumber() {
        return registrationNumber;
    }

    public void setRegistrationNumber(String registrationNumber) {
        this.registrationNumber = registrationNumber;
    }

    public int getStudentId() {
        return studentId;
    }

    public void setStudentId(int studentId) {
        this.studentId = studentId;
    }

    public int getYearOfStudy() {
        return yearOfStudy;
    }

    public void setYearOfStudy(int yearOfStudy) {
        this.yearOfStudy = yearOfStudy;
    }

    public Node getStudentNode(Document document) {
        Element studentNode = document.createElement("student");
        studentNode.setAttribute("studentId", getStudentId() + "");
        studentNode.setAttribute("registrationNumber", this.getRegistrationNumber());
        studentNode.setAttribute("yearOfStudy", this.getYearOfStudy() + "");
        studentNode.appendChild(document.createTextNode(this.getName()));
        return studentNode;
    }
}
